// 封装axios
import axios from 'axios'
// import router from '@/router'
import { getToken } from '@/utils/storage'
const request = axios.create({
  baseURL: 'http://liufusong.top:8080/'
  // timeout: 5000
})
// 请求拦截器
request.interceptors.request.use(config => {
  if (getToken()) {
    config.headers.Authorization = getToken()
  }
  return config
}, err => {
  return Promise.reject(err)
})
// 响应拦截器
request.interceptors.response.use(response => {
  return response
}, err => {
  return Promise.reject(err)
})

export default request
